#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "build dir $DIR"
cd $DIR

buildDocker=${1:-"docker"}
imagePrefix="kyun.km-metro.com/km-metro"
imageTag="latest"

if [ "$buildDocker" = "docker" ]; then
    echo "build docker image"
    DOCKER_IMAGE='afc-keyun-admin'
    docker build -t $imagePrefix/$DOCKER_IMAGE:$imageTag .
    docker push $imagePrefix/$DOCKER_IMAGE:$imageTag
    docker image rm $imagePrefix/$DOCKER_IMAGE:$imageTag
fi
